﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;

namespace OgilvyOne.Model
{
    /// <summary>
    /// 文章更多信息
    /// </summary>
    public class CmsArticleMore
    {
        private int moreid;

        public int Moreid
        {
            get { return moreid; }
            set { moreid = value; }
        }
        private int articleid;//文章ID

        public int Articleid
        {
            get { return articleid; }
            set { articleid = value; }
        }
        private string concactinfo;//联系信息

        public string Concactinfo
        {
            get { return concactinfo; }
            set { concactinfo = value; }
        }
        private string brands;//相关品牌IDS

        public string Brands
        {
            get { return brands; }
            set { brands = value; }
        }
        private string products; //相关产品IDS

        public string Products
        {
            get { return products; }
            set { products = value; }
        }
        private string mores;   //更多XML
        XmlDocument moresdoc;

        public string Mores
        {
            get { return mores; }
            set { 
                mores = value;
                if (mores != null && mores.Trim() != "")
                {
                    try
                    {
                        moresdoc = new XmlDocument();
                        XmlDeclaration decl = moresdoc.CreateXmlDeclaration("1.0", "UTF-8", null);
                        moresdoc.AppendChild(decl);
                        moresdoc.LoadXml(value);
                    }
                    catch
                    {

                    }
                }
            }
        }
        /// <summary>
        /// 更多信息获取指定key内容
        /// </summary>
        /// <param name="key">输入内容时设置的key</param>
        /// <returns></returns>
        public string GetMoresInfo(string key)
        {
            if (moresdoc != null)
            {
                XmlNode node = moresdoc.SelectSingleNode("//" + key);
                if(node!=null) return node.InnerText;
                return "";
            }
            return "";
        }
        public XmlDocument GetMoresXml()
        {
            return moresdoc;
        }

        private string subtitle;//副标题
        private string subtitle2;//副标题2

        public string Subtitle
        {
            get { return subtitle; }
            set { subtitle = value; }
        }
        public string Subtitle2
        {
            get { return subtitle2; }
            set { subtitle2 = value; }
        }
        private string subsidiary; //下属单位相关（业务/单位）信息

        public string Subsidiary
        {
            set { subsidiary = value; }
            get { return subsidiary; }
        }
    }
}
